using System.Collections.Generic;
using SQLDMO;
using SQLRunnerLib.Services;

namespace SQLRunnerDMO
{
    public class Util : ISQLServerFinder
    {
        /// <summary>
        /// This helper method returns a list of SQL Servers
        /// available at the local network
        /// </summary>
        /// <returns>List of strings</returns>
        public List<string> GetSQLServers()
        {
            Application oSQLApp = new ApplicationClass();
            NameList list = oSQLApp.ListAvailableSQLServers();
            List<string> results = new List<string>();
            for (int i = 1; i <= list.Count; i++)
            {
                results.Add(list.Item(i));
            }
            return results;
        }
    }
}
